package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
)

// 好像不行呀，不能postData 传数据
func main(){
	client := &http.Client{}

	form := url.Values{}
	form.Add("id","1")
	form.Add("ip","192.168.22.11")


	req,err := http.NewRequest("POST","http://www.01happy.com/demo/accept.php?id=122",bytes.NewReader([]byte(form.Encode())))
	if err != nil {
		fmt.Printf("err:%s",err)
		return
	}

	req.Header.Set("Content-Type","application/x-www-fom-urlencoded")
	req.Header.Set("Cookie","name=anny")


	resp,err := client.Do(req)
	defer resp.Body.Close()

	body,err := ioutil.ReadAll(resp.Body)

	if err != nil {
		fmt.Println("ioutil.ReadAll err :%s",err)
		return
	}
	fmt.Println(string(body))

}
